﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ecopsy.DataTier;
using AgencyEntityLib.Context ;

namespace AgencyEntityLib.BaseEntity
{
    public class Employeer : ContactFace  
    {
        private string _Login= string.Empty ;
        public string Login { get { return _Login; } set { _Login = value; } }

        private bool _Disabled = false;
        public bool Disabled { get { return _Disabled; } set { _Disabled = value; } }


        private string _DepartmentId = string.Empty;
        public string DepartmentId { get { return _DepartmentId; } set { _DepartmentId = value; } }



        private FilterList _FilterList = new FilterList();
        /// <summary>
        /// список общих фиьтров агенства
        /// </summary>
        public FilterList FilterList
        {
            get { return _FilterList; }
            set { _FilterList = value; }
        }


        [EntityNonSerialized]
        public string eMail
        {
            get
            {
                return GetContactValue(AgencyLib_GlobalConstants.Contact_Email);

            }
            set
            {
                SetContactValue(AgencyLib_GlobalConstants.Contact_Email, value);
            }
        }

        private string GetContactValue(string ContactType)
        {
            Contact c = ContactList.GetMainContact(ContactType);
            if (c == null) return string.Empty;
            return c.ContactValue;
        }


        private void SetContactValue(string ContactType, string ContactValue)
        {
            this.ContactList.RemoveItems(ContactType);
            this.ContactList.Add(new Contact { MainContact = true, ContactType = ContactType, ContactValue = ContactValue });
        }

     
        public string Comment { get;set;}
                
                
        private EntityList _Permissions = new EntityList();
        /// <summary>
        /// Перечень подразделений, для работы с ресурсами которых допущен сотрудник
        /// </summary>
        public EntityList Permission { get { return _Permissions; } set { _Permissions = value; } }

        
        [EntityNonSerialized]
        protected  override string TagName
        {
            get
            {
                return "Employeer";
            }
        }

        public override string LoadProcedure
    {
        get
        {
            return "EmployeeLoad";
        }
    }

        

    }

    
}
